feat(git-token-service): add opaque SCM session capabilities#3701
feat(git-token-service): add opaque SCM session capabilities#3701eshurakov wants to merge 4 commits into
Conversation
Code Review SummaryStatus: 1 Issue Remaining (unchanged) | Recommendation: Address before merge Executive SummaryThe new commit ( Overview
Issue Details (click to expand)WARNING
Resolved Issues
What changed in latest commit (7df3d07)
No new bugs, security gaps, or logic errors found. Files Reviewed (31 files)
Fix these issues in Kilo Cloud Reviewed by claude-4.6-sonnet-20260217 · 320,972 tokens Review guidance: REVIEW.md from base branch |
748bb09 to
a67a4a8
Compare
jeanduplessis
left a comment
There was a problem hiding this comment.
Code Review Summary
Status: No Issues Found | Recommendation: Merge
Executive Summary
Reviewed SCM session capability issuance, redemption, URL canonicalization, source revalidation, secret bindings, and regression coverage. No verified correctness, security, tracking, or test-quality issues remain.
Files Reviewed (26 files)
apps/web/src/app/api/integrations/gitlab/callback/route.test.tsapps/web/src/app/api/integrations/gitlab/connect/route.test.tsapps/web/src/lib/integrations/gitlab-service.test.tsapps/web/src/lib/integrations/gitlab-service.tsapps/web/src/lib/integrations/oauth/platforms/gitlab-callback.tsapps/web/src/lib/integrations/platforms/gitlab/adapter.test.tsapps/web/src/lib/integrations/platforms/gitlab/instance-url.test.tsapps/web/src/lib/integrations/platforms/gitlab/instance-url.tsapps/web/src/lib/integrations/platforms/gitlab/oauth-state.test.tsapps/web/src/lib/integrations/platforms/gitlab/oauth-state.tsservices/git-token-service/.dev.vars.exampleservices/git-token-service/src/github-session-capability.test.tsservices/git-token-service/src/github-session-capability.tsservices/git-token-service/src/gitlab-lookup-service.test.tsservices/git-token-service/src/gitlab-lookup-service.tsservices/git-token-service/src/gitlab-runtime-token-resolver.tsservices/git-token-service/src/gitlab-session-capability.test.tsservices/git-token-service/src/gitlab-session-capability.tsservices/git-token-service/src/gitlab-token-service.test.tsservices/git-token-service/src/gitlab-token-service.tsservices/git-token-service/src/gitlab-url.tsservices/git-token-service/src/index.test.tsservices/git-token-service/src/index.tsservices/git-token-service/test/test-worker.tsservices/git-token-service/worker-configuration.d.tsservices/git-token-service/wrangler.jsonc
Summary
Why
The staged SCM-containment rollout needs a token-service boundary that can issue short-lived, repository-scoped capabilities without returning raw GitHub or GitLab credentials during session setup. This PR ships that additive Worker slice first so the capability contract can be reviewed and deployed independently before the dependent Cloud Agent caller and outbound broker adopt it.
What was done
outboundContainerIdis supplied while retaining unbound v1 issuance as a temporary compatibility path for older callers.High-level architecture
sequenceDiagram participant Caller as Future SCM session caller<br/>(not in this PR) participant Broker as Future outbound broker<br/>(not in this PR) participant Token as git-token-service RPC participant Store as Authorized integration storage participant SCM as GitHub or GitLab rect rgb(245, 245, 245) Note over Caller,SCM: Capability issuance Caller->>Token: issue...(user, org?, repository, container?) Token->>Store: Resolve authorized SCM source opt Mint or refresh current credential Token->>SCM: Resolve current credential end Token-->>Caller: Opaque capability + non-secret session metadata end rect rgb(245, 245, 245) Note over Caller,SCM: Per-request redemption Broker->>Token: redeem...(capability, container?, method, URL) Token->>Token: Check expiry, binding, origin, repository, and allowlist Token->>Store: Re-read pinned source and verify identity opt Mint or refresh current credential Token->>SCM: Resolve current credential end Token-->>Broker: Credential-bearing header for approved request Broker->>SCM: Forward approved request end Note over Broker,SCM: Broker adoption and redirect re-redemption are follow-up workVerification
POST /getTokenForRepoagainst the live localgit-token-serviceWorker for an active organization-owned GitHub App integration; confirmed a successful standard installation-token lookup with the returned token redacted.git-token-serviceWorker with a throwaway capability key and exercised the local bridge end to end:POST /issueGitHubSessionCapabilityreturned a redacted boundkgh2capability, thenPOST /redeemGitHubSessionCapabilityreturned a redacted authorization header for an allowed Git transport URL.Visual Changes
N/A
Reviewer Notes
SCM_SESSION_CAPABILITY_ENCRYPTION_KEY_PRODbefore deploying the production Worker and the DEV counterpart before deployinggit-token-service-dev; rotating the key invalidates outstanding capabilities.outboundContainerId.